package library;

import library.Book;

public class ListBook {
    private Book[] listBook;    //存储书的书架
    private int size = 0;   //书的数量

    public ListBook(){
        listBook = new Book[100];
        listBook[size++] = new Book("西游记", "吴承恩", 100, "古典小说");
        listBook[size++] = new Book("水浒传", "施耐庵", 90, "古典小说");
        listBook[size++] = new Book("微积分", "高斯", 50, "数学");
        listBook[size++] = new Book("SQL必知必会", "钟鸣", 49, "计算机");
        listBook[size++] = new Book("新概念英语", "亚历山大", 39.9, "英语");
        listBook[size++] = new Book("水浒传", "施耐庵", 90, "古典小说");

    }
    //按索引从书架上获取某本书
    public Book getBook(int index) {
        return listBook[index];
    }
    //获取图书的总数
    public int getSize() {
        return size;
    }
    //按索引设置图书
    public void setBook(int index ,Book book) {
        this.listBook[index] = book;
    }
    //设置图书的总数
    public void setSize(int size) {
        this.size = size;
    }
}
